#!/bin/bash
#必须添加这一行，如果不加jenkins默认会在build之后杀死虽有衍生进程
export BUILD_ID=dontkillme
j=$(ps -ef|grep jenkins_test.jar | grep -v grep|awk '{print $2}')

if [ "$j" != "" ] ;then
	echo "不为空"
    j=$(ps -ef|grep jenkins_test.jar | grep -v grep|awk '{print $2}')
	kill "$j"
    sleep 3
fi
sleep 2
nohup java -jar $(pwd)/target/jenkins_test.jar >temp.log 2>&1 &
echo "启动成功"